/**
 * CodeSpirit 统计卡片前端SDK 样式
 * @version 1.0.0
 */

/* 网格布局 */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    padding: 20px;
}

.cards-grid-item {
    display: flex;
    flex-direction: column;
}

.cards-grid-item.small {
    grid-column: span 1;
}

.cards-grid-item.medium {
    grid-column: span 1;
}

.cards-grid-item.large {
    grid-column: span 2;
}

@media (max-width: 768px) {
    .cards-grid {
        grid-template-columns: 1fr;
        padding: 10px;
        gap: 15px;
    }
    
    .cards-grid-item.large {
        grid-column: span 1;
    }
}

/* 基础卡片样式 */
.card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    background: #fafafa;
}

.card-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #262626;
}

.card-subtitle {
    margin: 4px 0 0 0;
    font-size: 12px;
    color: #8c8c8c;
}

.card-body {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-actions {
    padding: 12px 20px;
    border-top: 1px solid #f0f0f0;
    background: #fafafa;
    display: flex;
    gap: 8px;
}

/* 统计卡片样式 */
.stat-card {
    min-height: 140px;
}

.stat-content {
    text-align: center;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: bold;
    line-height: 1;
    margin-bottom: 8px;
    color: #262626;
}

.stat-label {
    font-size: 14px;
    color: #8c8c8c;
    margin-bottom: 4px;
}

.stat-unit {
    font-size: 12px;
    color: #bfbfbf;
    margin-bottom: 8px;
}

.stat-trend {
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.stat-trend.trend-up {
    color: #52c41a;
}

.stat-trend.trend-down {
    color: #ff4d4f;
}

.stat-trend.trend-stable {
    color: #8c8c8c;
}

/* 图表卡片样式 */
.chart-card {
    min-height: 320px;
}

.chart-container {
    width: 100%;
    height: 100%;
}

/* Amis图表卡片样式 */
.amis-chart-card {
    min-height: 320px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.amis-chart-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.amis-chart-card .card-header {
    position: relative;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.amis-chart-card .card-badge {
    position: absolute;
    top: 12px;
    right: 16px;
    background: linear-gradient(135deg, #1890ff, #36cfc9);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(24, 144, 255, 0.3);
}

.amis-chart-container {
    width: 100%;
    height: 100%;
    position: relative;
    background: #fafafa;
    border-radius: 6px;
}

/* Amis图表备用样式 */
.amis-chart-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 6px;
    padding: 16px;
}

.amis-chart-fallback .chart-title {
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #262626;
    margin-bottom: 20px;
    opacity: 0;
    animation: fadeInDown 0.6s ease forwards;
}

.amis-chart-fallback .chart-bars {
    flex: 1;
    display: flex;
    align-items: end;
    justify-content: space-around;
    padding: 0 16px;
    min-height: 200px;
    gap: 8px;
}

.amis-chart-fallback .chart-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    height: 100%;
    max-width: 60px;
}

.amis-chart-fallback .bar-value {
    background: linear-gradient(180deg, var(--theme-color, #1890ff) 0%, rgba(24, 144, 255, 0.7) 100%);
    width: 100%;
    min-height: 4px;
    border-radius: 4px 4px 0 0;
    position: relative;
    cursor: pointer;
    transform: scaleY(0);
    transform-origin: bottom;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.amis-chart-fallback .bar-value:hover {
    transform: scaleY(1.05);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    filter: brightness(1.1);
}

.amis-chart-fallback .bar-value::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.8) 0%, transparent 100%);
    border-radius: 4px 4px 0 0;
}

.amis-chart-fallback .value-label {
    position: absolute;
    top: -24px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    font-weight: 600;
    color: #262626;
    background: rgba(255, 255, 255, 0.9);
    padding: 2px 6px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(4px);
}

.amis-chart-fallback .bar-value:hover .value-label {
    opacity: 1;
}

.amis-chart-fallback .bar-label {
    font-size: 11px;
    color: #8c8c8c;
    margin-top: 12px;
    text-align: center;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
}

.amis-chart-fallback .no-data {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #bfbfbf;
    font-size: 14px;
}

.amis-chart-fallback .no-data i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.amis-chart-fallback .no-data p {
    margin: 0;
    font-weight: 500;
}

/* 动画效果 */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 主题样式变化 */
.amis-chart-card.theme-primary .card-badge {
    background: linear-gradient(135deg, #1890ff, #40a9ff);
}

.amis-chart-card.theme-success .card-badge {
    background: linear-gradient(135deg, #52c41a, #73d13d);
}

.amis-chart-card.theme-warning .card-badge {
    background: linear-gradient(135deg, #faad14, #ffc53d);
}

.amis-chart-card.theme-danger .card-badge {
    background: linear-gradient(135deg, #ff4d4f, #ff7875);
}

.amis-chart-card.theme-info .card-badge {
    background: linear-gradient(135deg, #13c2c2, #36cfc9);
}

/* 主题柱状图颜色 */
.amis-chart-card.theme-success .bar-value {
    background: linear-gradient(180deg, #52c41a 0%, rgba(82, 196, 26, 0.7) 100%);
}

.amis-chart-card.theme-warning .bar-value {
    background: linear-gradient(180deg, #faad14 0%, rgba(250, 173, 20, 0.7) 100%);
}

.amis-chart-card.theme-danger .bar-value {
    background: linear-gradient(180deg, #ff4d4f 0%, rgba(255, 77, 79, 0.7) 100%);
}

.amis-chart-card.theme-info .bar-value {
    background: linear-gradient(180deg, #13c2c2 0%, rgba(19, 194, 194, 0.7) 100%);
}

/* 信息卡片样式 */
.info-card {
    min-height: 120px;
}

.info-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* 操作卡片样式 */
.action-card {
    min-height: 120px;
}

.action-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    justify-content: center;
}

.action-btn {
    min-width: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 14px;
}

/* 主题样式 */
.theme-default {
    border-left: 4px solid #1890ff;
}

.theme-default .stat-value {
    color: #1890ff;
}

.theme-primary {
    border-left: 4px solid #1890ff;
}

.theme-primary .stat-value {
    color: #1890ff;
}

.theme-success {
    border-left: 4px solid #52c41a;
}

.theme-success .stat-value {
    color: #52c41a;
}

.theme-warning {
    border-left: 4px solid #faad14;
}

.theme-warning .stat-value {
    color: #faad14;
}

.theme-danger {
    border-left: 4px solid #ff4d4f;
}

.theme-danger .stat-value {
    color: #ff4d4f;
}

.theme-info {
    border-left: 4px solid #13c2c2;
}

.theme-info .stat-value {
    color: #13c2c2;
}

/* 错误卡片样式 */
.card-error {
    border-left: 4px solid #ff4d4f;
    background: #fff2f0;
}

.error-message {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #ff4d4f;
    font-size: 14px;
}

/* 按钮样式 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    vertical-align: middle;
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: 4px;
    transition: all 0.3s ease;
    gap: 4px;
}

.btn:hover {
    opacity: 0.8;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 11px;
}

.btn-primary {
    background-color: #1890ff;
    color: #fff;
    border-color: #1890ff;
}

.btn-outline-primary {
    background-color: transparent;
    color: #1890ff;
    border-color: #1890ff;
}

.btn-outline-primary:hover {
    background-color: #1890ff;
    color: #fff;
}

/* 加载状态 */
.card-loading {
    position: relative;
    overflow: hidden;
}

.card-loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
    animation: loading 1.5s infinite;
    z-index: 1;
}

@keyframes loading {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* 响应式优化 */
@media (max-width: 576px) {
    .card-header {
        padding: 12px 16px;
    }
    
    .card-body {
        padding: 16px;
    }
    
    .card-actions {
        padding: 8px 16px;
        flex-direction: column;
    }
    
    .stat-value {
        font-size: 2rem;
    }
    
    .cards-grid {
        padding: 10px;
        gap: 10px;
    }
}

/* 暗黑主题支持 */
@media (prefers-color-scheme: dark) {
    .card {
        background: #1f1f1f;
        color: #fff;
    }
    
    .card-header {
        background: #262626;
        border-bottom-color: #434343;
    }
    
    .card-title {
        color: #fff;
    }
    
    .card-subtitle {
        color: #bfbfbf;
    }
    
    .card-actions {
        background: #262626;
        border-top-color: #434343;
    }
    
    .stat-label {
        color: #bfbfbf;
    }
    
    .stat-unit {
        color: #8c8c8c;
    }
}

/* 打印样式 */
@media print {
    .card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .card:hover {
        transform: none;
    }
    
    .cards-grid {
        gap: 10px;
    }
} 